package com.voice.server.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Proxy;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

@Data
@Entity
@Table(name = "tbl_device")
@DynamicUpdate
@Proxy(lazy = false)
public class Device {

    public Device() { }

    public Device(String deviceKey, Integer pushType,String matchText) {
        this.deviceKey = deviceKey;
        this.pushType = pushType;
        this.matchText=matchText;
    }

    /*主键*/
    @Id
    @GeneratedValue(generator="uuid")
    @GenericGenerator(name = "uuid",strategy = "uuid2")
    private String id;

    /*创建时间*/
    @CreationTimestamp
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createDateTime;

    @Column(unique = true)
    /*
    * 设备key
    * */
    private String deviceKey;

    /*
    * 设备加密串
    * */
    private String deviceSecret;

    @Column(unique = true)
    /*
    * 设备mac地址
    * */
    private String mac;

    /*
    * 设备状态
    * */
    private Integer status;

    /*
    * 工作时间1
    * */
    private String startTime;

    /*
   * 工作时间2
   * */
    private String endTime;

    /*
    * 推送类型
    * */
    private Integer pushType;

    /*
    * 匹配文字
    * */
    private String matchText;

    /*
    * 绑定用户id
    * */
    private String userId;
}
